From: Alastair Tse Date: Wed, 31 Jan 2007 12:58:41 +0000 (+0000) Subject: [XEND] Make python-pam warning only appear if using XenAPI X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15368^2~1 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22%22?a=commitdiff_plain;h=6501ac6994ade911cc15bd64325dab4a3fffbcfc;p=xen.git [XEND] Make python-pam warning only appear if using XenAPI Signed-off-by: Alastair Tse --- diff --git a/tools/python/xen/xend/XendAuthSessions.py b/tools/python/xen/xend/XendAuthSessions.py index 5c9a4e9a2f..769c66f3fa 100644 --- a/tools/python/xen/xend/XendAuthSessions.py +++ b/tools/python/xen/xend/XendAuthSessions.py @@ -21,11 +21,6 @@ from xen.xend import uuid from xen.xend.XendError import * from xen.xend.XendLogging import log -try: - import PAM -except ImportError: - log.warn("python-pam is required for XenAPI support.") - class XendAuthSessions: """Keeps track of Xen API Login Sessions using PAM. @@ -80,7 +75,11 @@ class XendAuthSessions: """ pam_auth = None try: + import PAM pam_auth = PAM.pam() + except ImportError: + log.warn("python-pam is required for XenAPI support.") + return False except NameError: # if PAM doesn't exist, let's ignore it return False